import os

def read_text_file(file_path):
    list=[]
    try:
        with open(file_path, "r", encoding="utf-8") as file:
            for line in file:
                lineStr = line.strip()  # strip() 去除行末的换行符
                # print(lineStr[5:])
                list.append(lineStr[5:])
            return list
    except FileNotFoundError:
        print(f"文件不存在: {file_path}")
    except Exception as e:
        print(f"读取文件时出错: {e}")

def write_text_file(file_path,list):
    try:
        with open(file_path, "w", encoding="utf-8") as f:
            for item in list:
                f.write(f"{item}\n")  # 写入元素并添加换行符
    except FileNotFoundError:
        print(f"文件不存在: {file_path}")
    except Exception as e:
        print(f"读取文件时出错: {e}")


# 获取脚本的绝对路径
script_dir = os.path.dirname(os.path.abspath(__file__))
# 构建目标文件的路径
split_text_path = os.path.join(script_dir, "根据符号切割.txt") 

split_text_list= read_text_file(split_text_path)

for str in split_text_list:
    strArray=str.split('.')
    if len(strArray) >1:
        print(str.split('.')[1])
    else:
        print(str.split('.')[0])
    